#!/bin/bash

#
# A gnu configure like script to configure a Qt based project.
# Just call this script to find the best suited qmake utility on
# you sysetem (even if it's not on your path)

# public domain - elcuco _at_ kde.org

# default search path[s] for Qt
QT_AVAILABLE_DIRS="$QTDIR /usr/local/Trolltech/Qt-4.0.0 /usr/local/Trolltech/4.0.1 /usr/local/qt /usr/lib/qt /usr/lib/qt3 /usr/lib/qt/3"

if [ "aa$QTDIR" == "aa" ]; then
	QMAKE=$(which qmake)
else
	QMAKE=$(which qmake)
fi

if [ "a$QMAKE" == "a" ]; then
	echo "qmake not found $QMAKE"
	for DIR in $QT_AVAILABLE_DIRS; do
		echo -n "Testing for qamke in $DIR"
		QMAKE=$DIR/bin/qmake
		if [ "a$QMAKE" != "a" ]; then
			echo "FOUND!"
			break;
		fi
		echo "not found"
	done
fi

if [ "a$QMAKE" == "a" ]; then
	echo "Fatal: qmake was not found"
	echo "You need to install qmake in order to compile this project"
	echo
	exit
fi

echo "qmake found at $QMAKE..."
echo "Configuring project..."
$QMAKE

echo "Project configured. Now you make call make"
echo 
